package com.isoft.demooa.controller;

import com.isoft.demooa.entity.ResponseMessage;
import com.isoft.demooa.entity.User;
import com.isoft.demooa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
@CrossOrigin
public class UserController {


    @Autowired
    private UserService userService;

    @RequestMapping("/list")
    public List<User> getAll(){

        return  userService.getAll();
    }


    @RequestMapping(value = "/login")
    public ResponseMessage login(User user){
        return  userService.login(user);
    }

}
